
<div id="admin-content" style="width:100%; vertical-align:top;">
	<h3>Quản lý hóa đơn</h3>
	<div id="body">
	<?php
		if(isset($this->thongbao)){
			echo '<div class="alert alert-success alert-dismissable">';
			echo '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>';
			echo $this->thongbao;
			echo '</div>';
		}

		if(isset($this->products))
			$products = $this->products;

		$lnkAdd = $this->url('admin',
					array(
							'controller'=>'bill',
							'action'=>'create-bill'
					));
		$lnkAdd = '<a class="btn btn-primary" href="' . $lnkAdd . '">Thêm hóa đơn</a>';
		echo $lnkAdd;
	?>
	<form>
		<table width="100%" id="data" class="table">
		<thead>
			<tr>
			<td></td>
				<td>STT</td>
				<td>Mã Hóa Đơn</td>
				<td>Mã Hàng</td>
				<td>Khách hàng</td>
				<td>Ngày tạo</td>
				<td>Số lượng</td>
				<td>Đơn giá</td>
				<td>Thành tiền</td>
				<td>Thao tác</td>

			</tr>
		</thead>
		<tbody>
			<tr>
				<td></td>
				<td></td>
				<td></td>
				<td><input type="text" class="form-control" width="100%"/></td>
				<td><input type="text" class="form-control" width="100%"/></td>
				<td><input type="date" class="form-control" width="100%"/></td>
				<td></td>
				<td></td>
				<td></td>
				<td></td>
			</tr>
			<?php
				$counter = 0;
				foreach ($bills as $bill) {
					$counter++;
					echo '<tr>';
					echo '<td class="txtCenter"><input type="checkbox" value=""></td>';
					echo '<td class="txtCenter">'.$counter.'</td>';
					echo '<td class="txtCenter">'.$bill->maHoaDon.'</td>';
					echo '<td class="txtCenter">'.$bill->maHang.'</td>';
					echo '<td class="txtCenter">'.$bill->idUser.'</td>';
					echo '<td class="txtCenter">'.$bill->ngay.'</td>';
					echo '<td class="txtCenter">'.$bill->soLuong.'</td>';
					echo '<td class="txtCenter">'.$bill->gia.'</td>';
					$x = $bill->soLuong;
					$x = (int)$x;
					$y = $bill->gia;
					$y = (int)$y;
					$z = $x*$y;
					echo '<td>'.$z.'</td>';
					echo '<td class="txtCenter">';
					$lnkEdit = $this->url('admin',
											array(
												 'controller'=>'bill',
												 'action'=>'edit',
												 'id' => $bill->maHoaDon
											));
					$lnkEdit = '<a style="margin-top:3px;"class="btn btn-primary" href="' . $lnkEdit . '">Sửa</a>';

					$lnkDelete 	= $this->url('admin',
									array(
											'controller'=>'bill',
											'action'=>'delete',
											'id' => $bill->maHoaDon
									));
					$lnkDelete = '<a style="margin-top:3px;"class="btn btn-danger" href="' . $lnkDelete . '">Xóa</a>';
					echo $lnkEdit . '&nbsp' . $lnkDelete;
					echo '</td>';
					echo '</tr>';
				}
			?>
		</tbody>
		</table>
		</div>
		<div class="edit">
			<button class="btn btn-success" type="submit">Update</button> &nbsp;
			<button class="btn btn-danger" type="submit">Delete</button>
		</div>
	</form>
</div>
<style>
table[id=data]{
	margin-top: 12px;
}
table[id=data] thead{
	font-weight: bold;
}
table[id=data] tbody tr:hover{
	background-color: #eee;
}
table[id=data] tbody td{
	vertical-align: middle;
}
</style>